#ifndef CONTACTS_H
#define CONTACTS_H

#include <QtGui/QMainWindow>

#include "ui_contacts.h"

class Contacts : public QMainWindow {
    Q_OBJECT

public:
    Contacts(QWidget *parent = 0);
    ~Contacts();

    // used to hold all of the contact groups and information
    QList<QString> contactsList;

    // used for debugging
    void addToConsole(const QString & text);

    // called if the user doesn't have any contacts
    void noContacts();

    // creates the menu
    //void createMenu();

    // populates the contacts field with the appropriate contacts
    void populateContacts(int i);

    // populates the header fields of the contacts table
    void populateContactsInfoHeaders();

    // fills in the blank cells with text
    void fillBlankCells(int neededGroups);

private:
    Ui::Contacts *contactsWindow;

    // holds names of contacts
    QStringList ContactsInfo_TableHeaders;

    // used to place the groups in the groups table
    int groupCount_;

    // makes sure that unwanted functions aren't called during startup
    bool startUpIsOver_;

    //QString groupClicked;
    QString cellClicked;

    // used to make sure the user doesn't add blank contact info.
    QString contactClicked_;

    // keeps track of when a group was actually clicked or not
    bool groupClicked_;

    // makes sure the bottom half of the constructor isn't used
    // if this is false because there would be no contacts to load
    bool newContacts_;

    // make sure to not call receiveGroupChanged when adding a group
    // and when constructor is being called
    bool noRealGroupChange_;


private slots:
    void on_addContactsButton_clicked();
    void on_deleteGroupButton_clicked();
    void on_exit_clicked();

    void receiveGroupClicked();
    void receiveGroupSelectedWithArrows();

    void receiveDeleteContactClicked();

    void receiveAddGroupClicked();

    void receiveContactChanged();
    void receiveGroupChanged();

    void receiveCellClicked();
    void receiveContactClicked();

    void receiveSaveButtonClicked();

    //used only for debugging
    void receivedDebug();

    // shows the user all of the text that's in a cell
    // Especially helpful if all of it isn't visible from the table
    void receiveContactClickedExpand();
};

#endif // CONTACTS_H
